﻿@model IEnumerable<Qu.SeniorProject.Model.ProjectSummary>

@{
    ViewBag.Title = ViewBag.Message;
    Layout = "~/Views/Shared/_Layout.cshtml";
}

@section head {

   <link href="@Url.Content("~/Content/GradesTable.css")" rel="stylesheet" type="text/css" />
   <script src="@Url.Content("~/Scripts/jquery.tablesorter.min.js")" type="text/javascript"></script>
   <script language="javascript" type="text/javascript">
       $(function () {
           $("#projectsTable").tablesorter();
       });

        $(function () {
            $("#PeriodIDdropdown").live("change keyup", function () {
                this.form.submit();
            })
        });
   </script>
 }

@if (ViewBag.Message != null && ViewBag.Message == "Projects")
{
    using (Html.BeginForm())
    {
        <b>Academic Year:</b> @Html.AjaxDropdown("PeriodID", controller: "ProjectPeriodAjaxDropdown") //, htmlAttributes: new { onchange = "this.form.submit();" })
        <br />
    }
}
else
{
    <h2>@ViewBag.Message</h2>
}


@foreach (var item in Model)
{
    <table width="100%" >
    <thead>
    <tr>
        <th>
            ID
        </th>
        <th>
            Title
        </th>
        <th>
            Students
        </th>
        <th>
            Supervisors
        </th>
@*        <th>
            ProposalExaminer
        </th>
        <th>
            Examiners
        </th>*@
        <th>
            Year
        </th>
    </tr>
    </thead>
    <tbody>
    <tr>
        <td width="30px">
            @Html.ActionLink(item.ProjectID.ToString(), "ProjectDetails", new { id = item.ProjectID }) 
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Title)
        </td>
        <td>
             @Html.Raw(item.Students)
        </td>
        <td>
             @Html.Raw(item.Supervisors)
        </td>
@*        <td>
            @Html.DisplayFor(modelItem => item.ProposalExaminer)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Examiners)
        </td>*@
        <td>
            @Html.DisplayFor(modelItem => item.ProjectYear)
        </td>
    </tr>
    @if (!string.IsNullOrEmpty(item.Abstract))
    {
        <tr>
            <td colspan="5">
                 <b>Abstract: </b><br />
                 @Html.Raw(item.Abstract)
                 <br />
            </td>
        </tr>
    }
    
    @if (!string.IsNullOrEmpty(item.ProjectTasks))
    {
        <tr>
            <td colspan="5">
                 <b>Tasks: </b><br />
                 @Html.Raw(item.ProjectTasks)
                 <br />
            </td>
        </tr>
    }
        </tbody>
    </table>
    <br /><br />
}

<br />
<div>
    @Html.ActionLink("Back to Home", "Index")
</div>